/*
  wxTriangulator
  Copyright 2008 Boleslaw Kulbabinski

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include<wx/wx.h>

#include<vector>
#include<algorithm>

using std::vector;
using std::pair;
using std::make_pair;
using std::min;
using std::max;

class Triangulator : public wxApp
{
public:
        virtual bool OnInit();

	bool IsEmpty();
	bool IsFinished();
	bool IsTriangulated();

	pair<VP_c_iter, VP_c_iter> GetPolygon();
	pair<VL_c_iter, VL_c_iter> GetTriangulation();

	Point AddPoint(long x, long y);
	Point Finish();
	void Triangulate();
	void Clear();

private:
	vector<Point> polygon;
	vector<pair<int, int> > *triangulation_indexes;
	vector<Line> triangulation_segments;

	bool finished;
	bool triangulated;
};

DECLARE_APP(Triangulator);

